
export const getUUID = (str) => {
  return `0000${str}-0000-1000-8000-00805F9B34FB`
}

export const UUID_WSP_181D = getUUID('181D')//wsp 秤的标识
export const UUID_WSP_1805 = getUUID('1805')
export const UUID_WSP_READ = getUUID('FFF1')
export const UUID_WSP_WRITE = getUUID('FFF2')
export const UUID_WSP_FFE1 = getUUID('FFE1')
export const UUID_WSP_FFE2 = getUUID('FFE2')
export const UUID_WSP_2A2B = getUUID('2A2B')
export const UUID_WSP_2A9D = getUUID('2A9D')
export const UUID_WSP_2A9E = getUUID('2A9E')
export const UUID_WSP_181C = getUUID('181C')
export const UUID_WSP_2A9F = getUUID('2A9F')
export const UUID_WSP_181B = getUUID('181B')
export const UUID_WSP_2A9B = getUUID('2A9B')
export const UUID_WSP_2A9C = getUUID('2A9C')
export const UUID_WSP_2A8C = getUUID('2A8C')
export const UUID_WSP_2A8E = getUUID('2A8E')
export const UUID_WSP_2A85 = getUUID('2A85')
export const UUID_WSP_2A80 = getUUID('2A80')
export const UUID_WSP_2AFF = getUUID('2AFF')


export const wspTime = () => {
  //跟 App 统一 UTC 时间
  let d = new Date
  let year = d.getUTCFullYear()
  let month = d.getUTCMonth() + 1
  let day = d.getUTCDate()
  let hour = d.getUTCHours()
  let min = d.getUTCMinutes()
  let sec = d.getUTCSeconds()
  let week = d.getUTCDay()

  week = week == 0 ? 7 : week

  return [year & 0xff, year >> 8, month, day, hour, min, sec, week, 0, 0]
}

//根据问题选择，获取对应算法
export const algorithmValue = (person_body_shape, person_goal) => {
  let algorithm = {
    '1-1': 3,
    '1-2': 3,
    '1-3': 3,
    '2-1': 3,
    '2-2': 2, //废弃
    '2-3': 2, //废弃
    '2-4': 3,
    '2-5': 3,
    '3-1': 3, //废弃
    '3-2': 12,
    '3-3': 12,
    '3-6': 2,
    '3-7': 2,
    '4-1': 3,
    '4-2': 3,
    '4-3': 3
  }

  return algorithm[`${person_body_shape}-${person_goal}`] || 3
}


export const isWsp = (advertisArrayData, advertisServiceUUIDs) => {

  if (advertisServiceUUIDs && advertisServiceUUIDs[0] == UUID_WSP_181D && advertisArrayData.length == 19) {
    return true
  }
  return false
}